package com.example.tuter.entity;


import com.example.tuter.util.httpUtil.HttpCodeConstant;

import java.io.Serializable;


public class Message<T> implements Serializable {
    private Meta meta;
    private T data;

    public Message() {
    }

    public Message(Meta meta, T data) {
        this.meta = meta;
        this.data = data;
    }

    public int getCode() {
        return meta.getStatus();
    }

    public Meta getMeta() {
        return meta;
    }

    public void setMeta(Meta meta) {
        this.meta = meta;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    static class Meta {
        Integer status;
        String description;

        public Meta(HttpCodeConstant httpCodeConstant) {
            this.status = httpCodeConstant.getValue();
            this.description = httpCodeConstant.getFiled();
        }

        public Meta() {

        }

        public Integer getStatus() {
            return status;
        }

        public void setStatus(Integer status) {
            this.status = status;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }
    }
}
